//
//  RxDZNEmptyDataSet.swift
//  RxDZNEmptyDataSet
//
//  Created by melvyn on 2018/8/17.
//  Copyright © 2018 NEET. All rights reserved.
//

import Foundation
import RxSwift
import RxCocoa


fileprivate final class DZNEmptyDataSetSourceNotSet: NSObject, DZNEmptyDataSetSource {
}

open class RxDZNEmptyDataSetSourceProxy
: DelegateProxy<UIScrollView, DZNEmptyDataSetSource>
, DelegateProxyType
, DZNEmptyDataSetSource {

    public weak private(set) var scrollView: UIScrollView?
    
    public init(scrollView: UIScrollView) {
        self.scrollView = scrollView
        super.init(parentObject: scrollView, delegateProxy: RxDZNEmptyDataSetSourceProxy.self)
    }
    
    public static func registerKnownImplementations() {
        self.register {  RxDZNEmptyDataSetSourceProxy(scrollView: $0) }
    }
    
    public static func currentDelegate(for object: UIScrollView) -> DZNEmptyDataSetSource? {
        return object.emptyDataSetSource
    }
    
    public static func setCurrentDelegate(_ delegate: DZNEmptyDataSetSource?, to object: UIScrollView) {
        object.emptyDataSetSource = delegate
    }    
}

